from DEFlib import *
import ColorLib
import pygame
import time
import sys
import random
import math
import os

# 非线性移动函数

def nonlinear_move(current, target, k, dt):
    return target + (current - target) * math.exp(-k * dt)


def checkzero(num):
    if num < 0:
        return 0
    else:
        return num


def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    try:
        # The directory containing the unpacked data files when running with PyInstaller
        base_path = sys._MEIPASS
    except AttributeError:
        # The directory of the running script when not using PyInstaller
        base_path = os.path.abspath(".")

    return os.path.join(base_path, relative_path)